package com.qfedu.fe.vo;

import com.qfedu.fe.config.SystemConfig;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 指尖造梦，精益求精
 *
 * @Author: Feri
 * @Date:2024/7/16 09:28
 * @Modified:
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultVo<T> {
    private Integer code;
    private String msg;
    private T data;

    /**
     * 成功*/
    public static <T> ResultVo ok(T data){
        return new ResultVo(SystemConfig.R_OK,"操作成功",data);
    }
    public static ResultVo ok(){
        return ok(null);
    }
    /**
     * 失败*/
    public static ResultVo fail(Object data){
        return new ResultVo(SystemConfig.R_FAIL,"操作失败",data);
    }
    public static ResultVo fail(){
        return fail(null);
    }

}
